// 创建store,需要的工具
import {
  legacy_createStore as createStore,
  applyMiddleware,
  combineReducers,
} from 'redux'
// thunk 中间件
import thunk from 'redux-thunk'
// 数据查看插件
import { composeWithDevTools } from 'redux-devtools-extension'
// 导入模块 （业务）reducer
import { login } from './reducers/login'
import { user } from './reducers/user'
import { home } from './reducers/home'
import { article } from './reducers/article'
// rootReducer 合并到一个部门统一管理
const rootReducer = combineReducers({ login, user, home, article })

// 插件 thunk 中间件
const middleWares = composeWithDevTools(applyMiddleware(thunk))

// 导出创建的store
export const store = createStore(rootReducer, middleWares)
